home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / v_attrib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-10  |  6.3 KB  |  323 lines

  1. /*
  2.  *    Vdi attribute funcs library interface
  3.  *
  4.  *        ++jrb    bammi@cadence.com
  5.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  6.  *
  7.  * 92/03/10 mmn -- Markus_Nick@mz.maus.de
  8.  *        changed return type of vst_height from void to int
  9.  *        because vst_height returns the selected height
  10.  *    
  11.  * 950313 cg (d2cg@dtek.chalmers,se)
  12.  *        modified for Pure C
  13.  *
  14.  * -------------------------------------
  15.  * 12.07.97 cf (felsch@tu-harburg.de)
  16.  *        modified for new control arrays
  17.  *
  18.  * 15.06.98
  19.  *        - restructured, new bindings for all functions
  20.  */
  21. #include "gem.h"
  22.  
  23. /*
  24.  * general attributes
  25. */
  26. void vs_color(int handle, int index, int rgb[])
  27. {
  28.     vdi_intin[0] = index;
  29.     vdi_intin[1] = rgb[0];
  30.     vdi_intin[2] = rgb[1];
  31.     vdi_intin[3] = rgb[2];
  32.  
  33.     vdi_control[0] = 14;
  34.     vdi_control[1] = 0;
  35.     vdi_control[3] = 4;
  36.     vdi_control[6] = handle;
  37.     vdi(&vdi_params);
  38. }
  39.  
  40. int vswr_mode(int handle, int mode)
  41. {
  42.     vdi_intin[0] = mode;
  43.     
  44.     vdi_control[0] = 32;
  45.     vdi_control[1] = 0;
  46.     vdi_control[3] = 1;
  47.     vdi_control[6] = handle;
  48.     vdi(&vdi_params);
  49.     return (int)vdi_intout[0];
  50. }
  51.  
  52.  
  53. /*
  54.  * fill attributes
  55. */
  56. int vsf_color(int handle, int index)
  57. {
  58.     vdi_intin[0] = index;
  59.     vdi_control[0] = 25;
  60.     vdi_control[1] = 0;
  61.     vdi_control[3] = 1;
  62.     vdi_control[6] = handle;
  63.     vdi(&vdi_params);
  64.     return (int)vdi_intout[0];
  65. }
  66.  
  67. int vsf_interior(int handle, int style)
  68. {
  69.     vdi_intin[0] = style;
  70.     vdi_control[0] = 23;
  71.     vdi_control[1] = 0;
  72.     vdi_control[3] = 1;
  73.     vdi_control[6] = handle;
  74.     vdi(&vdi_params);
  75.     return (int)vdi_intout[0];
  76. }
  77.  
  78. int vsf_perimeter(int handle, int vis)
  79. {
  80.     vdi_intin[0] = vis;
  81.     vdi_control[0] = 104;
  82.     vdi_control[1] = 0;
  83.     vdi_control[3] = 1;
  84.     vdi_control[6] = handle;
  85.     vdi(&vdi_params);
  86.     return (int)vdi_intout[0];
  87. }
  88.  
  89. int vsf_style(int handle, int style)
  90. {
  91.     vdi_intin[0] = style;
  92.     vdi_control[0] = 24;
  93.     vdi_control[1] = 0;
  94.     vdi_control[3] = 1;
  95.     vdi_control[6] = handle;
  96.     vdi(&vdi_params);
  97.     return (int)vdi_intout[0];
  98. }
  99.  
  100. void vsf_udpat(int handle, int pat[], int planes)
  101. {
  102.     register int i, j;
  103.      
  104.     j = planes << 4;
  105.     for(i = 0; i < j; i++)
  106.         vdi_intin[i] = pat[i];
  107.     vdi_control[0] = 112;
  108.     vdi_control[1] = 0;
  109.     vdi_control[3] = j;
  110.     vdi_control[6] = handle;
  111.     vdi(&vdi_params);
  112. }
  113.  
  114.  
  115. /*
  116.  * line attributes
  117. */
  118. int vsl_color(int handle, int index)
  119. {
  120.     vdi_intin[0] = index;
  121.     vdi_control[0] = 17;
  122.     vdi_control[1] = 0;
  123.     vdi_control[3] = 1;
  124.     vdi_control[6] = handle;
  125.     vdi(&vdi_params);
  126.     return (int)vdi_intout[0];
  127. }
  128.  
  129. void vsl_ends(int handle, int begstyle, int endstyle)
  130. {
  131.     vdi_intin[0] = begstyle;
  132.     vdi_intin[1] = endstyle;
  133.     vdi_control[0] = 108;
  134.     vdi_control[1] = 0;
  135.     vdi_control[3] = 2;
  136.     vdi_control[6] = handle;
  137.     vdi(&vdi_params);
  138. }
  139.  
  140. int vsl_type(int handle, int style)
  141. {
  142.     vdi_intin[0] = style;
  143.     vdi_control[0] = 15;
  144.     vdi_control[1] = 0;
  145.     vdi_control[3] = 1;
  146.     vdi_control[6] = handle;
  147.     vdi(&vdi_params);
  148.     return (int)vdi_intout[0];
  149. }
  150.  
  151. void vsl_udsty(int handle, int pat)
  152. {
  153.     vdi_intin[0] = pat;
  154.     vdi_control[0] = 113;
  155.     vdi_control[1] = 0;
  156.     vdi_control[3] = 1;
  157.     vdi_control[6] = handle;
  158.     vdi(&vdi_params);
  159. }
  160.  
  161. int vsl_width(int handle, int width)
  162. {
  163.     vdi_ptsin[0] = width;
  164.     vdi_ptsin[1] = 0;
  165.     vdi_control[0] = 16;
  166.     vdi_control[1] = 1;
  167.     vdi_control[3] = 0;
  168.     vdi_control[6] = handle;
  169.     vdi(&vdi_params);
  170.     return (int)vdi_ptsout[0];
  171. }
  172.  
  173.  
  174. /*
  175.  * marker attributes
  176. */
  177. int vsm_color(int handle, int index)
  178. {
  179.     vdi_intin[0] = index;
  180.     vdi_control[0] = 20;
  181.     vdi_control[1] = 0;
  182.     vdi_control[3] = 1;
  183.     vdi_control[6] = handle;
  184.     vdi(&vdi_params);
  185.     return (int)vdi_intout[0];
  186. }
  187.  
  188. int vsm_height(int handle, int height)
  189. {
  190.     vdi_ptsin[0] = 0;
  191.     vdi_ptsin[1] = height;
  192.     vdi_control[0] = 19;
  193.     vdi_control[1] = 1;
  194.     vdi_control[3] = 0;
  195.     vdi_control[6] = handle;
  196.     vdi(&vdi_params);
  197.     return (int)vdi_intout[0];
  198. }
  199.  
  200. int vsm_type(int handle, int symbol)
  201. {
  202.     vdi_intin[0] = symbol;
  203.     vdi_control[0] = 18;
  204.     vdi_control[1] = 0;
  205.     vdi_control[3] = 1;
  206.     vdi_control[6] = handle;
  207.     vdi(&vdi_params);
  208.     return (int)vdi_intout[0];
  209. }
  210.  
  211.  
  212. /*
  213.  * text attributes
  214. */
  215. void vst_alignment(int handle, int hin, int vin, int *hout, int *vout)
  216. {
  217.     vdi_intin[0] = hin;
  218.     vdi_intin[1] = vin;
  219.     vdi_control[0] = 39;
  220.     vdi_control[1] = 0;
  221.     vdi_control[3] = 2;
  222.     vdi_control[6] = handle;
  223.     vdi(&vdi_params);
  224.     *hout = vdi_intout[0];
  225.     *vout = vdi_intout[1];
  226. }
  227.  
  228. int vst_color(int handle, int index)
  229. {
  230.     vdi_intin[0] = index;
  231.     vdi_control[0] = 22;
  232.     vdi_control[1] = 0;
  233.     vdi_control[3] = 1;
  234.     vdi_control[6] = handle;
  235.     vdi(&vdi_params);
  236.     return (int)vdi_intout[0];
  237. }
  238.  
  239. int vst_effects(int handle, int effects)
  240. {
  241.     vdi_intin[0] = effects;
  242.     vdi_control[0] = 106;
  243.     vdi_control[1] = 0;
  244.     vdi_control[3] = 1;
  245.     vdi_control[6] = handle;
  246.     vdi(&vdi_params);
  247.     return (int)vdi_intout[0];
  248. }
  249.  
  250. void vst_error(int handle, int mode, short *errorvar)
  251. {
  252.     vdi_intin[0] = mode;
  253.     *(short **)&vdi_intin[1] = (short *)&errorvar;
  254.     vdi_control[0] = 245;
  255.     vdi_control[1] = 0;
  256.     vdi_control[3] = 3;
  257.     vdi_control[6] = handle;
  258.     vdi(&vdi_params);
  259. }
  260.  
  261. int vst_font(int handle, int font)
  262. {
  263.     vdi_intin[0] = font;
  264.     vdi_control[0] = 21;
  265.     vdi_control[1] = 0;
  266.     vdi_control[3] = 1;
  267.     vdi_control[6] = handle;
  268.     vdi(&vdi_params);
  269.     return (int)vdi_intout[0];
  270. }
  271.  
  272. int vst_height(int handle, int height,    int *charw, int *charh, int *cellw, int *cellh)
  273. {
  274.     vdi_ptsin[0] = 0;
  275.     vdi_ptsin[1] = height;
  276.     vdi_control[0] = 12;
  277.     vdi_control[1] = 1;
  278.     vdi_control[3] = 0;
  279.     vdi_control[6] = handle;
  280.     vdi(&vdi_params);
  281.     *charw = vdi_ptsout[0];
  282.     *charh = vdi_ptsout[1];
  283.     *cellw = vdi_ptsout[2];
  284.     *cellh = vdi_ptsout[3];
  285.     return (int)vdi_intout[0];
  286. }      
  287.  
  288. int vst_point(int handle, int point, int *charw, int *charh, int *cellw, int *cellh)
  289. {
  290.     vdi_intin[0] = point;
  291.     vdi_control[0] = 107;
  292.     vdi_control[1] = 0;
  293.     vdi_control[3] = 1;
  294.     vdi_control[6] = handle;
  295.     vdi(&vdi_params);
  296.     *charw = vdi_ptsout[0];
  297.     *charh = vdi_ptsout[1];
  298.     *cellw = vdi_ptsout[2];
  299.     *cellh = vdi_ptsout[3];
  300.     return (int)vdi_intout[0];
  301. }      
  302.  
  303. int vst_rotation(int handle, int ang)
  304. {
  305.     vdi_intin[0] = ang;
  306.     vdi_control[0] = 13;
  307.     vdi_control[1] = 0;
  308.     vdi_control[3] = 1;
  309.     vdi_control[6] = handle;
  310.     vdi(&vdi_params);
  311.     return (int)vdi_intout[0];
  312. }
  313.  
  314. void vst_scratch(int handle, int mode)
  315. {
  316.     vdi_intin[0] = mode;
  317.     vdi_control[0] = 244;
  318.     vdi_control[1] = 0;
  319.     vdi_control[3] = 1;
  320.     vdi_control[6] = handle;
  321.     vdi(&vdi_params);
  322. }
  323.